#ifndef GAMEMAP_HPP
#define GAMEMAP_HPP
#include <stdint.h>
#include <iostream>
#include <string>
#include <vector>
#include "coordinate.hpp"
#include "piece_type.hpp"

using std::cout;
using std::cerr;
using std::endl;
using std::string;
using std::vector;
using std::to_string;
using std::ostream;

class Exception{
	private:
	protected:
		string cont;

	public:
		Exception(const string &str):cont(str){}

		Exception(string &&str){ cont = std::move(str); }

		virtual const string &what()noexcept{ return cont; }
};

class GameMap{
	private:
	protected:
		uint8_t *ptr;
		int r, c;

	public:
		GameMap(int r = 10, int c = 9);

		uint8_t *operator[](int x);

		uint8_t &operator[](const Coordinate &coor);

		const uint8_t *operator[](int x)const;

		uint8_t operator[](const Coordinate &coor)const;

		GameMap &operator=(const GameMap &gm);

		GameMap &operator=(GameMap &&gm);

		uint8_t queryCoor(int x, int y);

		uint8_t queryCoor(const Coordinate &coor);

		inline uint8_t row()const noexcept{ return r; }

		inline uint8_t col()const noexcept{ return c; }

		void clear()noexcept;

		void present(ostream &os)noexcept;

		virtual ~GameMap();
};

extern GameMap gameMap;

#endif
